var mysql = require('mysql')
var co = mysql.createConnection({
    host: '119.45.34.210',
    user: 'root',
    password: '123456',
    port: '3306',
    database: 'book'
})

co.connect();

const addSql = `INSERT INTO book_list ( name, author, date, price)
                       VALUES
                       ( ?, ?, ?, ? );`;
const addSqlParams = ['钢铁是怎样练成的', '高尔基', '1989-10-23', 65];

co.query(addSql, addSqlParams, (err, result, filelds) => {
    if (err) throw err
    console.log('[insert] succeed!')
    console.log('insert result:', result)
});

co.end((err) => {
    if (err) throw err;
    console.log('[connenct end] succeed!')
});

// console.log('sql')
